package top.zuli.package01.class15;

import org.junit.Test;

import java.util.Date;

public class TestDemo1 {
    @Test
    public void DateConstructorTest(){
        //创建日期对象，返回系统的当前时间
        Date date = new Date();
        System.out.println(date);
        //创建距离格林尼治时间标准时间过了1000毫秒的日期
        Date date2 = new Date(1000L);
        System.out.println(date2);
    }
    @Test
    public void DateMethodTest(){
        //创建两个日期对象
        Date date1 = new Date();
        Date date2 = new Date(1000L);
        //date1是否在date2之前
        System.out.println(date1.before(date2));
        //date1是否在date2之后
        System.out.println(date1.after(date2));
        //获得date2距离格林尼治时间过了多少毫秒
        System.out.print(date2.getTime());
    }
}

/*
public class TestDemo1 {
    @Test
    public void DateConstructorTest(){
        Date date = new Date();
        System.out.println(date);
        Date date2 = new Date(1000L);
        System.out.println(date2);
    }
    @Test
    public void DateMethodTest(){
        Date date1 = new Date();
        Date date2 = new Date(1000L);
        System.out.println(date1.before(date2));
        System.out.println(date1.after(date2));
        System.out.print(date2.getTime());
    }
}
*/

/*
public class TestDemo1 {
    @Test
    public void DateConstructorTest(){
        Date date = new Date();
        System.out.println(date);
        Date date2 = new Date(1000L);
        System.out.println(date2);
    }
    @Test
    public void DateMethodTest(){
        Date date1 = new Date();
        Date date2 = new Date(1000L);
        System.out.println(date1.before(date2));
        System.out.println(date1.after(date2));
        System.out.print(date2.getTime());
    }
}
*/

/*
public class TestDemo1 {
    @Test
    public void DateConstructorTest(){
        Date date = new Date();
        System.out.println(date);
        Date date2 = new Date(1000L);
        System.out.println(date2);
    }
    @Test
    public void DateMethodTest(){
        Date date1 = new Date();
        Date date2 = new Date(1000L);
        System.out.println(date1.before(date2));
        System.out.println(date1.after(date2));
        System.out.print(date2.getTime());
    }
}
*/
